namespace JQuery.WebKit
{
    using System.Security.Permissions;
    using System.Web;

    [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal), AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)]
    public class WebGridColumnCollection : BaseItemCollection<WebGrid, WebGridColumn>
    {
        protected override object CreateKnownType(int index)
        {
            return new WebGridColumn();
        }
        
        public WebGridColumn this[string dataField]
        {
            get { return this.FromDataField(dataField); }
        }

        public WebGridColumn FromDataField(string dataField)
        {
            for (int i = 0; i < base.Count; i++)
            {
                WebGridColumn column = base[i];
                if (column.DataField == dataField)
                {
                    return column;
                }
            }
            return null;
        }
    }
}

